(function(){
$.weboo.view("weboo.core.form",null,null,{setup: function(view,conf){
	/* load standard setting */
	view.loadSetting(conf);

	view.afterSave = conf.afterSave;

	view.onSave = function(){
		this.save();
	};

	view.save = function(callback){
		if(!conf.dest_save) throw "You must define a property named 'dest_save' to indicate where to save!!!"
		var me = this;
		$.weboo.ajax({
			url			: $.weboo.url(conf.dest_save)
			,data		: this.data()
			,processData: true
			,cache		: false
			,async		: !$.weboo.undefined(callback)
			,type		: "POST"
			,dataType	: "json"
			,success	: function(json){
				me.blank();
				me.data(json);
				me.redraw();
				if($.weboo.isFunction(callback))
					callback(me);
				if(me.afterSave)
					me.afterSave();
			}
		});
	};

	view.fetch = function(data,callback){
		if(!conf.dest_fetch) throw "You must define a property named 'dest_fetch' to indicate where to fetch!!!"
		var me = this;
		$.weboo.ajax({
			url			: $.weboo.url(conf.dest_fetch)
			,data		: data
			,processData: true
			,cache		: false
			,async		: !$.weboo.undefined(callback)
			,type		: "POST"
			,dataType	: "json"
			,success	: function(json){
				me.blank();
				me.data(json);
				me.redraw();
				if($.weboo.isFunction(callback))
					callback(me);
			}
		});
	};

	view.reset = function(){
		this.blank();
		this.redraw();
	};
}});
})(jQuery);